import urllib.request
url = 'http://www.baidu.com/'
#发送请求
response = urllib.request.urlopen(url,timeout=0.001)
if response.getcode() == 200:
    print(response.read().decode('utf-8'))